package com.yunhai.device.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yunhai.common.dto.PaginationVo;
import com.yunhai.common.dto.Ret;
import com.yunhai.device.service.OrrOutcupEfficiencyDetailService;
import com.yunhai.model.entity.orr.OrrOutcupEfficiencyDetailEntity;
import com.yunhai.model.vo.orr.OrrOutcupEfficiencyDetailQuery;
import com.yunhai.model.vo.orr.OrrOutcupEfficiencyDetailVo;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/orrOutcupEfficiencyDetail")
public class OrrOutcupEfficiencyDetailController {

	@Resource
	private OrrOutcupEfficiencyDetailService orrOutcupEfficiencyDetailService;


	/**
	 * 获取 OrrOutcupEfficiencyDetail 分页列表
	 */
	@GetMapping("/pagination")
	public Ret getOrrOutcupEfficiencyDetailPagination(PaginationVo paginationVo, OrrOutcupEfficiencyDetailQuery orrOutcupEfficiencyDetailQuery ) throws Exception {
		IPage page = orrOutcupEfficiencyDetailService.getOrrOutcupEfficiencyDetailPagination(paginationVo, orrOutcupEfficiencyDetailQuery );
		return Ret.toPage(page);
	}


	/**
	 * 获取 OrrOutcupEfficiencyDetail 所有数据
	 */
	@GetMapping("/allList")
	public Ret getOrrOutcupEfficiencyDetailAllList( OrrOutcupEfficiencyDetailQuery orrOutcupEfficiencyDetailQuery ) throws Exception {
		List<OrrOutcupEfficiencyDetailEntity> list = orrOutcupEfficiencyDetailService.getOrrOutcupEfficiencyDetailAllList( orrOutcupEfficiencyDetailQuery );
		return Ret.ok(list);
	}


	/**
	 * 获取 OrrOutcupEfficiencyDetail 详情
	 */
	@GetMapping("/{id}")
	public Ret getOrrOutcupEfficiencyDetailDetailById(@PathVariable Long id) throws Exception {

	    OrrOutcupEfficiencyDetailEntity orrOutcupEfficiencyDetailEntity = orrOutcupEfficiencyDetailService.getOrrOutcupEfficiencyDetailDetail(id);
		return Ret.ok(orrOutcupEfficiencyDetailEntity);
	}


	/**
	 * 新增 OrrOutcupEfficiencyDetail
	 * */
	@PostMapping("")
	public Ret addOrrOutcupEfficiencyDetail(@RequestBody OrrOutcupEfficiencyDetailVo orrOutcupEfficiencyDetailVo) throws Exception {

		orrOutcupEfficiencyDetailService.addOrrOutcupEfficiencyDetail(orrOutcupEfficiencyDetailVo);
		return Ret.ok();
	}


	/**
	 * 更新 OrrOutcupEfficiencyDetail
	 * */
	@PutMapping("")
	public Ret updateOrrOutcupEfficiencyDetail(@RequestBody OrrOutcupEfficiencyDetailVo orrOutcupEfficiencyDetailVo) throws Exception {

		orrOutcupEfficiencyDetailService.updateOrrOutcupEfficiencyDetail(orrOutcupEfficiencyDetailVo);
		return Ret.ok();
	}


	/**
	 * 删除 OrrOutcupEfficiencyDetail
	 * */
	@PostMapping("/batchRemove")
	public Ret batchRemoveOrrOutcupEfficiencyDetail( @RequestBody List<Long> ids ) throws Exception {

	    orrOutcupEfficiencyDetailService.batchRemoveOrrOutcupEfficiencyDetail(ids);
		return Ret.ok();
	}
}
